package com.bizdroid.unutturma.activity;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.widget.Button;

import com.bizdroid.unutturma.model.ReminderItem;
import com.bizdroid.unutturma.utility.Utility;

public class NotificationActivity extends Activity {
    /** Called when the activity is first created. */
	
	private static final String TAG = "UnuttturmaLocationServiceTest";
	Button buttonStart, buttonStop;
	String contentMessage;
	String key;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
    	
    	Log.d(TAG, "UnutturmaActivity onCreate");
    	
        super.onCreate(savedInstanceState);
        
        Intent i = getIntent();
        Bundle extras = i.getExtras();

        contentMessage = extras.getString("contentMessage");
        key = extras.getString("key");
        System.out.println("intentKey");
        
        
        AlertDialog.Builder adb = new AlertDialog.Builder(
        		NotificationActivity.this);
		adb.setMessage(contentMessage);
		adb.setNegativeButton("Tamam",
				new AlertDialog.OnClickListener() {
					public void onClick(DialogInterface dialog,
					int which) {
					
						callNextActivity();
						
			}
		});
		adb.setPositiveButton("Ertele",
				new AlertDialog.OnClickListener() {
					public void onClick(DialogInterface dialog,
							int which) {
						finish();
					}
				});
		adb.show();
	    
    }
    
    public void callNextActivity(){
    	
    	ReminderItem reminderItem = Utility.getReminderItemByKey(this, key);
		System.out.println("******gonderiyor: "+key);
		Utility.deleteReminderItem(reminderItem, this);
		
		
    	Intent nextScreen = new Intent(this,ReminderActivity.class);
		startActivity(nextScreen);
    }
}